package org.example.blogserver.controller;

import org.example.blogserver.handler.TokenManager;
import org.example.blogserver.service.SysUserService;
import org.example.blogserver.vo.Result;
import org.example.blogserver.vo.params.UserInfoParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("admin")
public class AdminController {

    @Autowired
    private SysUserService sysUserService;

    @DeleteMapping("/remove-user")
    public Result removeUser(@RequestHeader("token") String token, @RequestBody UserInfoParam userInfoParam){
        return sysUserService.deleteUser(token,userInfoParam.getAccount());
    }
    @GetMapping("/view")
    public Result getUserList(){
        return sysUserService.getUserList();
    }
}
